<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="content">
            <h:form rendered="#{loginBacking.viewSalesOrder}">
                <p:messages />
                <br />
                <ui:include src="/entities/salesOrderEntity/ViewSO.xhtml" />
                <br />                
                <ui:include src="/entities/purchaseOrderEntity/ViewToBeIncluded.xhtml" />
                <br />
                <ui:include src="/entities/shippingRequestEntity/ListShippingRequests.xhtml" />
                <br />
                <ui:include src="/entities/shippingOrderEntity/ListForSOForInclude.xhtml" />
                <br />
                <ui:include src="/entities/salesOrderEntity/ViewCreditPayment.xhtml" />
                <br />
                <ui:include src="/entities/billingRequestEntity/ListToBeIncluded.xhtml" />
                <br />
                <ui:include src="/entities/salesOrderEntity/ViewMetaInfo.xhtml" />
                <br />

                <p:menuButton value="Basic Functions" >
                    <p:menuitem ajax="false"  
                                action="#{salesOrderEntityController.confirmSO}" value="Confirm" rendered="#{salesOrderEntityController.confirmButton()==true}"/>  

                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.suspendSO}" value="Suspend" rendered="#{salesOrderEntityController.suspendEditButton()==true}"/> 

                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.resumeSO}" value="Resume" rendered="#{salesOrderEntityController.resumeButton()==true}"/>

                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.cancelSO}" value="Cancel" rendered="#{salesOrderEntityController.cancelButton()==true}"/>

                    <p:menuitem ajax="false" 
                                action="Edit" value="#{bundle.ViewSalesOrderEntityEditLink}" rendered="#{salesOrderEntityController.suspendEditButton()==true}"/>

                    <p:menuitem ajax="false" 
                                value="#{bundle.ViewSalesOrderEntityEditLink}" rendered="#{salesOrderEntityController.suspendEditButton()==false}"/>

                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.destroyAndView}" value="Delete" rendered="#{loginBacking.deleteSalesOrder}"/>

                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.prepareList}" value="Show All"/>

                </p:menuButton>

                <p:menuButton value="Advance Functions" >
                    <p:menuitem ajax="false" 
                                action="#{salesOrderEntityController.generateShippingOrders}" 
                                value="Generate Shipping Orders" 

                                rendered="#{shippingOrderEntityController.allShippingOrders.size()==0 and salesOrderEntityController.canRegenerateShippingOrders()}"/>
                    <p:menuitem ajax="false"
                                action="#{salesOrderEntityController.performCreditCheck}" value="Credit Check"
                                rendered="#{salesOrderEntityController.needToPerformCreditCheck()}"/>

                </p:menuButton>    




                <br />
                &nbsp;<p:commandLink ajax="false" action="ViewTab" value="Tab View" />
                &nbsp;<p:commandLink ajax="false" action="View" value="Brief View" />
                <br />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
